package com.caojing.haolemai.ui.category;

import com.caojing.haolemai.bean.categorybean.CategoryBean;
import com.caojing.haolemai.httputils.HttpUtils;

/**
 * Created by My on 2016/10/17.
 */
public class CategoryPresenter  implements CatrgoryContract.Presenter{

    private CatrgoryContract.Model model;
    private CatrgoryContract.View view;

    public CategoryPresenter(CatrgoryContract.View view){
        this.view=view;
        model = new CategoryModel();
    }

    @Override
    public void initCategoryData() {
        //调用model里的方法，加载数据
        model.getCategoryBean(new HttpUtils.HttpCallBack<CategoryBean>() {
            @Override
            public void onSucess(CategoryBean categoryBean) {
               // Log.i("TAG","--------------->initCategoryData");
                view.onSuccessGetCategoryBean(categoryBean);
            }

            @Override
            public void onFail() {
                view.onFailGetCategoryBean("请检查网路");
            }
        });
    }
}
